-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SuperKeyboard] - Created a keyboard plugin #2474
Conversation
@angelosilvestre I'm gonna merge this so that I can create an initial release and use it in super_editor. Please feel free to leave comments that we can handle in followup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some comments.
|
||
private var channel: FlutterMethodChannel? | ||
|
||
// private var displayLink: CADisplayLink? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the commented lines.
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { | ||
switch call.method { | ||
default: | ||
result(FlutterMethodNotImplemented) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add a comment here explaining that we don't handle any methods from Flutter because all events come from the platform.
import 'package:logging/logging.dart'; | ||
import 'package:super_keyboard/src/keyboard.dart'; | ||
|
||
class SuperKeyboardAndroidBuilder extends StatefulWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a dart doc.
} | ||
} | ||
|
||
class SuperKeyboardAndroid { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a dart doc explaining how to use it.
import 'package:logging/logging.dart'; | ||
import 'package:super_keyboard/src/keyboard.dart'; | ||
|
||
class SuperKeyboardIOSBuilder extends StatefulWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a dart doc.
} | ||
} | ||
|
||
class SuperKeyboardIOS { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a dart doc explaining how to use it.
import 'package:super_keyboard/src/super_keyboard_android.dart'; | ||
import 'package:super_keyboard/src/super_keyboard_ios.dart'; | ||
|
||
class SuperKeyboardBuilder extends StatefulWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a dart doc.
void _init() { | ||
log.info("Initializing SuperKeyboard"); | ||
if (defaultTargetPlatform == TargetPlatform.iOS) { | ||
log.fine("SuperKeyboard - Initializing for iOS"); | ||
SuperKeyboardIOS.instance.keyboardState.addListener(_onIOSKeyboardChange); | ||
} else if (defaultTargetPlatform == TargetPlatform.android) { | ||
log.fine("SuperKeyboard - Initializing for Android"); | ||
SuperKeyboardAndroid.instance.keyboardState.addListener(_onAndroidKeyboardChange); | ||
SuperKeyboardAndroid.instance.keyboardHeight.addListener(_onAndroidKeyboardHeightChange); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we log something if this is used in another platform?
case TargetPlatform.android: | ||
tester.view.physicalSize = const Size(1170, 2532); // iPhone 13 Pro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to reset this value when the test finishes?
[SuperKeyboard] - Created a keyboard plugin.
The plugin reports four keyboard states on Android and iOS: closed, opening, open, closing.
The Android implementation also reports the keyboard height.
This plugin was created to provide more dependable knowledge about keyboard state for Super Editor's chat scaffold.
This PR moves Super Editor's test keyboard simulator into the new keyboard package. A followup PR will remove it from super_editor.